package com.shycloud.mido.common.security.service;

import lombok.Getter;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @author npc
 * @date 2018/8/20
 * 扩展用户信息
 */
public class ShyMember extends User {

	/** 用户ID */
	@Getter
	private String id;
	/** 用户名 */
	@Getter
	private String loginname;
	/** 手机 */
	@Getter
	private String phone;
	@Getter
	/** 机构ID */
	private Integer orgId;
	@Getter
	/** 机构名 */
	private String orgName;
	@Getter
	/** 是否教师 */
	private String isTeacher;
	@Getter
	/** 性别 */
	private String sex;
	@Getter
	/** 生日 */
	private String birthday;
	@Getter
	/** 昵称 */
	private String showName;
	@Getter
	/** 头像 */
	private String header;
	@Getter
	/** 账号ID */
	private String account;
	@Getter
	private String loginType;
	@Getter
	private String wxFlg;
	/** 微信的 openId */
	@Getter
	private String wxOpenId = "0";

	public ShyMember(
			String id,
			String loginname,
			String phone,
			String username,
			String password,
			Integer orgId,
			String orgName,
			String sex,
			String birthday,
			String isTeacher,
			String showName,
			String header,
			String account,
			String loginType,
			String flg,
			String wxOpenId,
			boolean enabled,
			boolean accountNonExpired,
			boolean credentialsNonExpired,
			boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {

		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
		this.orgId = orgId;
		this.orgName = orgName;
		this.sex = sex;
		this.birthday = birthday;
		this.isTeacher = isTeacher;
		this.id = id;
		this.loginname = loginname;
		this.phone = phone;
		this.showName = showName;
		this.header = header;
		this.account = account;
		this.loginType = loginType;
		this.wxFlg = flg;
		this.wxOpenId = wxOpenId;
	}

	public ShyMember(String id, String loginname, String phone, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
		this.id = id;
		this.loginname = loginname;
		this.phone = phone;
	}
}
